﻿using System;
using wojilu.Apps.Qycms.Domain;
using wojilu.Web.Mvc.Attr;

namespace wojilu.Web.Controller.Big5.Message
{
    public class ListController : BaseTempController
    {
        public ListController()
        {
            LayoutControllerType = typeof(Big5Controller);
        }

        [NonVisit]
        public virtual void setpublic()
        {
            set("top", loadHtml(new Big5.PublicController().Top));
            set("bottom", loadHtml(new Big5.PublicController().Bottom));
        }

        [HttpGet]
        public virtual void Show(Int64 Id)
        {
            var b = Bbs_TypeList.findById(Id);
            var template = String.Empty;
            if (!b.templates.StrIsNullOrEmpty())
            {
                template = b.templates;
            }
            else
            {
                switch (b.ispage)
                {
                    case 0:
                        template = "message_bbs";
                        break;

                    case 1:
                        template = "message_list";
                        break;

                    case 2:
                        template = "message_center";
                        break;
                }
            }
            view(DefaultTemp + "Message/" + template);
            //标题、关键词、描述
            var Title = String.Empty;
            var Keywords = String.Empty;
            var Description = String.Empty;
            var Position = String.Empty;

            Title = b.typename + "-" + YBBCommon.GetLangStr(CurrentLng, "sitename");
            Keywords = YBBCommon.GetLangStr(CurrentLng, "keyword");
            Description = YBBCommon.GetLangStr(CurrentLng, "description");

            ctx.Page.SetTitle(Title);
            ctx.Page.Keywords = Keywords;
            ctx.Page.Description = Description;

            Position += "<span>" + b.typename + "</span>";
            set("daohang", Position);

            set("typeread", b);
            setpublic();
            SetPublic();
        }

    }
}
